/**
 * Project Name:pums-ui
 * File Name:index.js
 * Package Name:opinion
 * Description: 意见征集相关
 * Date:2019/5/29 10:37
 * Copyright (c) 2019, yxw@bostech.com.cn All Rights Reserved.
 */


// 不同类型不同的名称
export const typeMap = {
  '1':'课题计划-征求意见',
  '2':'课题研究-征求意见',
  '3':'规划编制-征求意见',
  '4':'课题征集-征求意见',
  '5':'审批发布-会审'
};

// 不同类型不同的名称
export const btnNameMap = {
  '1':'',
  '2':'',
  '3':'',
  '4':'',
  '5':''
};

// 不同类型字段显示不同的文字
export const titleDictMap = {
  '1':'',
  '2':'',
  '3':'',
  '4':'',
  '5':{
    'zqzt':'会审主题',
    'hsbm':'会审部门',
    'jzrq':'会审截止日期',
    'ygsm':'有关说明',
    'xgcl':'相关材料'
  }
};

// 不同类型不同的验证
export const rulesDictMap = {
  '1':'',
  '2':'',
  '3':'',
  '4':'',
  '5':{
    supportDeptName: [
      {required: true, message: "请输入会审部门", trigger: "blur"}
    ],
    title: [
      {required: true, message: "请输入会审主题", trigger: "blur"}
    ],
    endDate: [
      {required: true, message: "请输入会审截止日期", trigger: "blur"}
    ],
  }
};

// 不同类型列表不同的显示
export const tableDictMap = {
  '1':'',
  '2':'',
  '3':'',
  '4':'',
  '5':[
    {
      label: "会审主题",
      prop: "title",
      cell: true,
      formatter: function (row, value, label, column) {
        return '<a style="cursor: pointer;" onclick="opinionDetail(\'' + row.opinionId + '\')">' + value + '</a>';
      },
    },
    {
      label: "截止日期",
      prop: "endDate",
      cell: true
    },
    {
      label: "创建人",
      prop: "createNickname",
      cell: true
    },
  ]
};

// 不同类型列表不同的显示 feedbackResult
export const resultTableDictMap = {
  '1':'',
  '2':'',
  '3':'',
  '4':'',
  '5':[
    {
      label: "会审主题",
      width: 290,
      prop: "title",
      cell: true
    },
    {
      label: "会审部门",
      prop: "deptName",
      cell: true
    },
    {
      label: "反馈部门",
      prop: "targetDeptName",
      cell: true
    },
    {
      label: "反馈时间",
      prop: "feedbackTime",
      formatter: function (row, value, label, column) {
        if (row.feedbackTime != null) {
          var data = row.feedbackTime.split(' ');
          return data[0];
        }
      },
      cell: true
    },
    {
      label: "状态",
      width: 80,
      prop: "state",
      dicData: [
        {
          label: '待反馈',
          value: '0'
        },
        {
          label: '已反馈',
          value: '2'
        },
        {
          label: '退回',
          value: '1'
        },
      ],
      cell: true,
      formatter: function (row, value, label, column) {
        if (row.state == '0') {
          return "<font color='red'>" + "催办" + "</font>";
        } else if (row.state == '1') {
          return "<font color='#DCA450'>" + "待反馈" + "</font>";
        } else if (row.state == '2') {
          return "<font color='#DCA450'>" + "退回" + "</font>";
        } else if (row.state == '3') {
          return "<font color='#DCA450'>" + "不采纳" + "</font>";
        } else if (row.state == '4') {
          return "<font color='#7EBE50'>" + "已反馈" + "</font>";
        } else if (row.state == '5') {
          return "<font color='#7EBE50'>" + "已采纳" + "</font>";
        }
      }
    },
  ]
};

/**
 * 不同类型调用不同的方法
 * getDetail:获取类型对应详情信息
 * @type
 */
export const stateUrlMap = {
  // 课题计划
  '1':{
    getDetail: function (self) {
      self.deptFirst()
    },
    // 添加征求意见
    addOpinion:function (self,form) {
      self.planAddOpinion(form)
    },
    updateForm:function (self) {
      self.planForm()
    },
  },
  // 课题研究
  '2':{
    getDetail: function (self) {
      self.gov()
    },
    // 添加征求意见
    addOpinion:function (self,form) {
      self.uploadAddOpinion(form)
    },
    updateForm:function (self) {
      self.uploadForm()
    },
  },
  // 规划编制
  '3':{
    getDetail: async function (self,id) {
      self.detailData = await self.getDetailData_result(id);
      self.detailDialogVisible = true
    },
    // 添加征求意见
    addOpinion:function (self,form) {
      self.makeTxtAddOpinion(form)
    },
    updateForm:function (self) {
      self.makeTxtUpdateForm()
    },
  },
  // 课题征集
  '4':{
    getDetail: function (self) {
      self.cityGov()
    },
    // 添加征求意见
    addOpinion:function (self,form) {
      self.subjectAddOpinion(form)
    },
    updateForm:function (self) {
      self.collectionForm()
    },
  },
  // 审批发布
  '5':{
    getDetail: function (self) {
      self.cityConpress()
    },
    // 添加征求意见
    addOpinion:function (self,form) {
      self.reviewAddOpinion(form)
    },
    updateForm:function (self) {
      self.reviewDiscussForm()
    },
  }
};


